<?php

namespace App\Admin\Controllers;

use App\UserFenshuSetting;
use Encore\Admin\Controllers\AdminController;
use Encore\Admin\Form;
use Encore\Admin\Grid;
use Encore\Admin\Show;
use Illuminate\Support\MessageBag;

class UserFenshuSettingController extends AdminController
{
    /**
     * Title for current resource.
     *
     * @var string
     */
    protected $title = 'App\UserFenshuSetting';

    /**
     * Make a grid builder.
     *
     * @return Grid
     */
    protected function grid()
    {
        $grid = new Grid(new UserFenshuSetting());

        $grid->column('id', __('Id'));
        $grid->column('base', __('基础分数'));
        $grid->column('new_fenshu', __('新分数'));
        $grid->column('chengjiao_fenshu', __('成交分数'));
        $grid->column('daofang_fenshu', __('到访分数'));
        $grid->column('genjin_fenshu', __('跟进分数'));
  

        return $grid;
    }

    /**
     * Make a show builder.
     *
     * @param mixed $id
     * @return Show
     */
    protected function detail($id)
    {
        $show = new Show(UserFenshuSetting::findOrFail($id));

        $show->field('id', __('Id'));
        $show->field('base', __('Base'));
        $show->field('new_fenshu', __('New fenshu'));
        $show->field('chengjiao_fenshu', __('Chengjiao fenshu'));
        $show->field('daofang_fenshu', __('Daofang fenshu'));
        $show->field('genjin_fenshu', __('Genjin fenshu'));
        $show->field('created_at', __('Created at'));
        $show->field('updated_at', __('Updated at'));

        return $show;
    }

    /**
     * Make a form builder.
     *
     * @return Form
     */
    protected function form()
    {
        $form = new Form(new UserFenshuSetting());

        $form->number('base', __('基础分数'));
        $form->number('new_fenshu', __('新人分数'));
        $form->number('chengjiao_fenshu', __('成交分数'));
        $form->number('daofang_fenshu', __('到访分数'));
        $form->number('genjin_fenshu', __('跟进分数'));
        $form->saved(function ($form){
            $success = new MessageBag([
                'title'   => '保存成功',

            ]);

            return back()->with(compact('success'));
        });
        return $form;
    }
}
